home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume2 / graphics / surf_3.of < prev   
Internet Message Format  |  1988-10-21  |  42KB

  1. Path: xanth!mcnc!rutgers!mit-eddie!ll-xn!adelie!infinet!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v02i004:  surf - produce bezier surfaces of revolution, Part03/03
  5. Message-ID: <9734@swan.ulowell.edu>
  6. Date: 20 Oct 88 01:35:51 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 1756
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: edavies@uvvm.bitnet (Eric Davies)
  12. Posting-number: Volume 2, Issue 4
  13. Archive-name: graphics/surf.3of3
  14.  
  15. # This is a shell archive.  Remove anything before this line
  16. # then unpack it by saving it in a file and typing "sh file"
  17. # (Files unpacked will be owned by you and have default permissions).
  18. # This archive contains the following files:
  19. #    ./README.DOC
  20. #    ./bezpt.c
  21. #    ./bezpt.h
  22. #    ./control.c
  23. #    ./control.h
  24. #    ./fasttrig.c
  25. #    ./fasttrig.h
  26. #    ./functions.h
  27. #    ./gadgetdef.c
  28. #
  29. if `test ! -s ./README.DOC`
  30. then
  31. echo "writing ./README.DOC"
  32. cat > ./README.DOC << '\Rogue\Monster\'
  33. Program: BezSurf
  34. Author: Eric Davies
  35. Resources and Tech Assistance: LateNight Developments (LND) Corporation.
  36.  
  37. Distribution
  38. ------------
  39. BezSurf is public domain. Feel free to copy it, enhance it, or port it to
  40. other machines, etc.
  41.  
  42. Compilation
  43. -----------
  44. Compiled under Lattice C 4.0 at the LND offices.
  45. Will also compile under Aztec 3.4a and up.
  46.  
  47. Software Disclaimer
  48. -------------------
  49. This is your standard software disclaimer:
  50.   Use this software at your risk.
  51.   Any loss of sleep is your own concern.
  52.  
  53. Document Disclaimer
  54. -------------------
  55. This document gives a partial description of BezSurf and its use. Many
  56. of the menu-items and gadgets are not described here. I believe most people
  57. will discover their purpose without too much trouble. If I'm wrong, you can
  58. query me by email at:
  59.         edavies@uvicctr
  60.      or edavies@uvvm.bitnet
  61. Or by snail mail (if some part of Canada Post is not on strike) at:
  62.       Eric Davies
  63.       1442 Harrop Rd.
  64.       Victoria, B.C.
  65.       Canada
  66.       V8P 2S6
  67. How soon you get a response depends on how behind my school work I am
  68. and how easily I can determine a return path to you :-).
  69.  
  70.  
  71. Description
  72. -----------
  73. BezSurf (or Surf for short) is a program for producing bezier surfaces of
  74. revolution. It produces awesome pictures of wineglasses and doorknobs, and
  75. other objects one could turn on a lathe. BezSurf includes the capacity to
  76. map iff image files onto any surface that it can draw.
  77.  
  78. History
  79. -------
  80. I originally wrote BezSurf for my final project in an introductory course
  81. in computer graphics at the University of Victoria. The target machine
  82. was a colour Sun Work Station. Being a loyal amigoid, I ported it down to
  83. the Amiga when I had a bit more free time, the Late Night Developers
  84. supplying resources and technical assistence as needed. I proudly claim any
  85. errors or bugs as my own, following the lead of a certain wine glass
  86. manufacturer, "the minute flaws in the product are your guarantee of its
  87. handcrafted nature".
  88.  
  89. Usage
  90. -----
  91. I've run it successfully from Matt Dillon's Shell and the bare cli.
  92. It should run fine from workbench, provided somebody whips up an icon
  93. for it.
  94.  
  95. Basic Usage
  96. -----------
  97.     Once run, you should see a 320x200 lores screen with the text
  98.     "lines curves wire shade map panel" along the top edge. These are the
  99.     basic control gadgets.
  100.  
  101.     1)  press "lines" (screen clears and crosshairs appear).
  102.         press and hold down the left mouse button.
  103.         move the mouse someplace else and release the button.
  104.         a line should have been rubber banded and left on the screen.
  105.         repeat as desired {
  106.             press and drag the mouse to define new line connected to
  107.             last one line.
  108.         }
  109.  
  110.     2)  press "curves".
  111.         the endpoints of the first line should be bracked by squares.
  112.         repeat as desired {
  113.             bring the left mouse button near one of squares.
  114.             press left button, move to new location, and release left button.
  115.             nearest square should have accompanied mouse, causing the
  116.             line to curve in strange and wonderful ways.
  117.             press right button to move the next line.
  118.         }
  119.  
  120.     3)  press "panel"
  121.         takes you to the control panel, so you can change the lighting, save
  122.         files, etc. It is suggested that you try "tilt" with about 20
  123.         degrees ( adds a more 3d effect ).
  124.         to get back to display, press [display] on the control panel.
  125.  
  126.     4)  press "wire"
  127.         generates wireframe with hidden line removal.
  128.  
  129.     5)  press "shade"
  130.         generates shaded image with hidden surface removal.
  131.  
  132.     6)  saving the images you created is done via the "files" menu in the
  133.         control panel.
  134.             save as... saves the ilbm to the specfied file name
  135.             save first... tacks on a ".0" to the file name and saves
  136.             save next... tacks on an ascending number and saves
  137.         "save first" and "save next" are provided in case somebody wants to
  138.         try producing animation sequences with Surf.
  139.  
  140.     7)  Anything else, excluding maps, should be self apparent with a little bit
  141.         of experimentation.
  142.  
  143. Error Messages
  144. --------------
  145. Error messages are displayed in a requestor. If displayed, you must click
  146. in the requestor's close box to continue. The messages usually indicate
  147. that your file name is wrong, screwy file contents, you don't have enough
  148. memory, etc.
  149.  
  150. Aborting a time consuming activity
  151. ----------------------------------
  152. Under the "Image" menu, the "abort" item will terminate any drawing in
  153. progress.
  154.  
  155. Mapping Iff images onto Surfaces (Grey Scale Result)
  156. --------------------------------
  157. This is my answer to photon paints mapping of images onto spheres, cones,
  158. etc. Before you can perform the mapping, you need two things: (1) a loaded
  159. map image, and (2) a surface { not necessarily in that order though its
  160. probably better to load the image first if you are not sure you have enough
  161. memory }.
  162.  
  163.     Loading the map image:
  164.         Go to the control panel window (see earlier discussion).
  165.         Under the files menu, select the "Open Map" item.
  166.         Enter the pathname of an ilbm image file (note:Ehb not supported).
  167.         Wait until the hourglass goes away.
  168.  
  169. Now, go and define a surface if you haven't already. Once you have both a
  170. surface defined and an image file loaded, click on the "Map" gadget on the
  171. display screen. Be prepared to wait an hour or two for your image to
  172. be produced, it is very slow.
  173.  
  174. Using lots of bezier and revolution slices (ie, very small patches) results
  175. in images that look less scarred.
  176.  
  177. The "MapRevV" and "MapRevH" sliders determine how many times the map image is
  178. replicated on the surface.
  179.  
  180. Closing the map file frees up the memory used to store the map image file.
  181. Openning a new map file automatically closes the old one.
  182.  
  183. Mapping Iff images onto Surfaces (Colour Result)
  184. --------------------------------
  185. The idea here is to produce three different image files, one that contains
  186. the red component, one the green, and one the blue. After the files are
  187. produced, use the mergergb tool to combine them into a single file for use
  188. by the RAY2 program available from the QRT (public domain) package or DBW
  189. (shareware).
  190.  
  191. procedure: set interlace and lores screen.
  192.            set the grey model to "R only"
  193.            load the iff image file
  194.            set the screen color to "Red" (or grey).
  195.            Generate the surface mapping.
  196.            Save with a ".r" extension.
  197.            set the grey model to "G only"
  198.            load the iff image file again
  199.            set the screen color to "Green" (or grey).
  200.            Generate the surface mapping.
  201.            Save with a ".g" extension.
  202.            set the grey model to "B only".
  203.            load the iff image file again.
  204.            set the screen color to "Blue" (or grey).
  205.            Generate the surface mapping.
  206.            Save with a ".b" extension.
  207.  
  208.            now run the mergergb program with the filename without extensions
  209.            as the sole argument. Ie, if you named the files smith.r, smith.g,
  210.            and smith.b, then type:
  211.                     mergergb smith
  212.            In this case, mergergb will produce smith.tmp, which can then be
  213.            fed into RAY2. Without other arguments, RAY2 wil produce an
  214.            interlaced ham image.
  215.  
  216. Future
  217. ------
  218. Be kind of neat if somebody adapted BezSurf to produce object descriptions
  219. for Sc*lpt3D or VideoSc*pe3D. Anyone feeling brave and bored?
  220.  
  221.  
  222. \Rogue\Monster\
  223. else
  224.   echo "will not over write ./README.DOC"
  225. fi
  226. if `test ! -s ./bezpt.c`
  227. then
  228. echo "writing ./bezpt.c"
  229. cat > ./bezpt.c << '\Rogue\Monster\'
  230. #include "scrnio.h"
  231. #include "control.h"
  232. #include "bezpt.h"
  233. #include "mytypes.h"
  234.  
  235. BezCoord Bezpt[MaxSegs+1];
  236.  
  237. int NumBezPts;
  238. int ActSeg;
  239. bool SegDrawn;
  240. int BezMesh = DefBezMeshVal;
  241. float BezStepSize = 1.0/DefBezMeshVal;
  242.  
  243. void SetBezMesh( value )
  244.     int value;
  245. {
  246.     BezMesh = value;
  247.     BezStepSize = 1.0/value;
  248. }
  249.  
  250.  
  251. void ClearSegments()
  252. {
  253.     NumBezPts = 0;
  254.     ActSeg = 0;
  255. }
  256.  
  257.  
  258. static  float xa, xb, xc, xd;
  259. static  float ya, yb, yc, yd;
  260. /*
  261.  * start up calculations that must be performed before calling
  262.  * CalcBezPt on any given segment
  263.  */
  264. void InitCalcBez()
  265. {
  266.         xa = -StartPtX(ActSeg) + 3.0*( Cntrl1X(ActSeg) - Cntrl2X(ActSeg))
  267.             + EndPtX(ActSeg);
  268.         xb = 3.0 *( StartPtX(ActSeg) + Cntrl2X(ActSeg) - 2.0*Cntrl1X(ActSeg));
  269.         xc = 3.0*( Cntrl1X(ActSeg) - StartPtX(ActSeg));
  270.         xd = StartPtX(ActSeg);
  271.  
  272.         ya = -StartPtY(ActSeg) + 3.0*( Cntrl1Y(ActSeg) - Cntrl2Y(ActSeg))
  273.             + EndPtY(ActSeg);
  274.         yb = 3.0 *( StartPtY(ActSeg) + Cntrl2Y(ActSeg) - 2.0*Cntrl1Y(ActSeg));
  275.         yc = 3.0*( Cntrl1Y(ActSeg) - StartPtY(ActSeg));
  276.         yd = StartPtY(ActSeg);
  277. }
  278.  
  279. /*
  280.  * calculate a point on the bezier curve of a segment
  281.  */
  282. void CalcBezPt( t, xvp, yvp)
  283.     float t;
  284.     float *xvp, *yvp;
  285. {
  286.     *xvp = (( t*xa + xb) * t + xc) *t + xd;
  287.  
  288.     *yvp = (( t*ya + yb) * t + yc) *t + yd;
  289. }
  290.  
  291.  
  292.  
  293. void XdrawBezSeg()
  294. {
  295.     float t;
  296.     float ftox, ftoy;
  297.     int fromx, fromy, tox, toy;
  298.  
  299.     InitCalcBez();
  300.     for( fromx = StartPtX(ActSeg), fromy = StartPtY(ActSeg), t=BezStepSize;
  301.         t < 1.0; fromx = tox, fromy = toy, t+= BezStepSize ) {
  302.  
  303.         CalcBezPt( t, &ftox, &ftoy );
  304.         tox = (int)ftox;
  305.         toy = (int)ftoy;
  306.         DrawLine( fromx, fromy, tox, toy, XOR );
  307.         DrawPnt( tox, toy, XOR );
  308.     }
  309.     DrawLine( fromx, fromy, EndPtX(ActSeg), EndPtY(ActSeg),XOR);
  310. }
  311.  
  312.  
  313.  
  314. void XdrawAllBezSegs()
  315. {
  316.     ResetActSeg();
  317.     do {
  318.         XdrawBezSeg();
  319.         NextSeg();
  320.     } while( ActSeg);
  321.  
  322.     DrawControl0();
  323.     DrawControl1();
  324. }
  325.  
  326.  
  327.  
  328. void ResetCurve()
  329. {
  330.     if( NumBezPts > 0 && CurMode == FITBEZIER ) {
  331.         int i;
  332.  
  333.         ClrWindow(true);
  334.         for( i = 0; i < NumBezPts; i++ ) {
  335.             Bezpt[i].x.cur1 = Bezpt[i].x.prev2 = Bezpt[i].x.cur0;
  336.             Bezpt[i].y.cur1 = Bezpt[i].y.prev2 = Bezpt[i].y.cur0;
  337.         }
  338.         ActSeg = 0;
  339.  
  340.         XdrawAllBezSegs();
  341.     }
  342. }
  343.  
  344.  
  345. /*
  346.  * set the value of a bezpt element
  347.  */
  348. static void SetBezPt( xval, yval )
  349.     int xval, yval;
  350. {
  351.     BezVal *i;
  352.  
  353.     i = &Bezpt[NumBezPts-1].x;
  354.     i->cur0 = i->prev2 = i->cur1 = xval;
  355.     i = &Bezpt[NumBezPts-1].y;
  356.     i->cur0 = i->prev2 = i->cur1 = yval;
  357. }
  358.  
  359.  
  360.  
  361.  
  362. void InitBezPt(xval,yval)
  363. int xval, yval;
  364. {
  365.     int segno;
  366.  
  367.     NumBezPts++;
  368.     SetBezPt(xval,yval);
  369.     segno = NumBezPts -2;
  370.     if( segno >= 0) {
  371.  
  372.         DrawLine( StartPtX( segno), StartPtY(segno),
  373.                 EndPtX( segno), EndPtY(segno), XOR );
  374.     }
  375. }
  376.  
  377.  
  378.  
  379.  
  380.  
  381. void EditBezPt(xval, yval)
  382. {
  383.     int segno = NumBezPts -2;
  384.  
  385.     DrawLine( StartPtX(segno), StartPtY(segno),
  386.           EndPtX( segno ), EndPtY(segno), XOR );
  387.  
  388.     SetBezPt(xval, yval);
  389.  
  390.     DrawLine( StartPtX( segno), StartPtY(segno),
  391.           EndPtX( segno), EndPtY(segno), XOR );
  392. }
  393.  
  394. \Rogue\Monster\
  395. else
  396.   echo "will not over write ./bezpt.c"
  397. fi
  398. if `test ! -s ./bezpt.h`
  399. then
  400. echo "writing ./bezpt.h"
  401. cat > ./bezpt.h << '\Rogue\Monster\'
  402. #include "fasttrig.h"
  403. /*
  404.  * structures and such for manipulating bezier curves
  405.  */
  406.  
  407. #define MaxSegs  50  /* max number of bezier segments */
  408.  
  409. typedef struct {
  410.     int prev2;  /* second control point of segment n-1 */
  411.     int cur0;   /* begin of segment n, end of segment n-1 */
  412.     int cur1;   /* first control point of segment n */
  413. } BezVal;
  414.  
  415.  
  416. typedef struct {
  417.     BezVal  x, y;
  418. } BezCoord;
  419.  
  420. #define DefBezMeshVal 10
  421.  
  422. extern BezCoord Bezpt[MaxSegs+1];
  423. extern void SetBezMesh( /* Panel_item, int, struct input_event */);
  424. extern int BezMesh;
  425. extern float BezStepSize;
  426.  
  427. extern void InitCalcBez( /* void */ );
  428. extern void CalcBezPt(/* float, float *, float * */);
  429. extern void XdrawAllBezSegs(/* void */);
  430. extern void XdrawBezSeg(/* void */);
  431. extern void InitBezPt( /* int, int */);
  432. extern void EditBezPt( /* int, int */);
  433. extern void ResetCurve( /* void */ );
  434.  
  435. extern int NumBezPts;
  436. extern int ActSeg;
  437.  
  438. #define GetNumSegs()    (NumBezPts-1)
  439. #define ResetActSeg()   { ActSeg = 0; }
  440. #define GetCurSeg()     (ActSeg)
  441. #define NextSeg()       { ActSeg = (ActSeg +1) %(NumBezPts -1); }
  442.  
  443. #define StartPtX(XSegNo) Bezpt[XSegNo].x.cur0
  444. #define StartPtY(XSegNo) Bezpt[XSegNo].y.cur0
  445.  
  446. #define Cntrl1X(XSegNo) Bezpt[XSegNo].x.cur1
  447. #define Cntrl1Y(XSegNo) Bezpt[XSegNo].y.cur1
  448.  
  449. #define Cntrl2X(XSegNo) Bezpt[XSegNo+1].x.prev2
  450. #define Cntrl2Y(XSegNo) Bezpt[XSegNo+1].y.prev2
  451.  
  452. #define EndPtX(XSegNo) Bezpt[XSegNo+1].x.cur0
  453. #define EndPtY(XSegNo) Bezpt[XSegNo+1].y.cur0
  454.  
  455. #define DrawControl0() DrawSqr( Bezpt[ActSeg].x.cur1,\
  456.                                 Bezpt[ActSeg].y.cur1, XOR )
  457.  
  458. #define DrawControl1() DrawSqr( Bezpt[ActSeg+1].x.prev2,\
  459.                                 Bezpt[ActSeg+1].y.prev2, XOR )
  460.  
  461. \Rogue\Monster\
  462. else
  463.   echo "will not over write ./bezpt.h"
  464. fi
  465. if `test ! -s ./control.c`
  466. then
  467. echo "writing ./control.c"
  468. cat > ./control.c << '\Rogue\Monster\'
  469. #include "bezpt.h"
  470. #include "control.h"
  471. #include "scrnio.h"
  472. #include "mytypes.h"
  473.  
  474. CURMODE CurMode  = DRAWPOLY;
  475.  
  476.  
  477. void SetFitBez()
  478. {
  479.     if( GetNumSegs() < 1 )  {
  480.         return;
  481.     }
  482.     ClrWindow(true);
  483.     CurMode = FITBEZIER;
  484.     XdrawAllBezSegs();
  485. }
  486.  
  487.  
  488.  
  489.  
  490. void SetPolyDraw()
  491. {
  492.     ClrWindow(true);
  493.     CurMode = DRAWPOLY;
  494.     ClearSegments();
  495. }
  496.  
  497.  
  498.  
  499.  
  500. void EditControl0(x,y)
  501. int x, y;
  502. {
  503.         DrawControl0();
  504.         XdrawBezSeg();
  505.         Cntrl1X(GetCurSeg()) = x;
  506.         Cntrl1Y(GetCurSeg()) = y;
  507.         XdrawBezSeg();
  508.         DrawControl0();
  509. }
  510.  
  511. void EditControl1(x,y)
  512. int x, y;
  513. {
  514.         DrawControl1();
  515.         XdrawBezSeg();
  516.         Cntrl2X(GetCurSeg()) = x;
  517.         Cntrl2Y(GetCurSeg()) = y;
  518.         XdrawBezSeg();
  519.         DrawControl1();
  520. }
  521. \Rogue\Monster\
  522. else
  523.   echo "will not over write ./control.c"
  524. fi
  525. if `test ! -s ./control.h`
  526. then
  527. echo "writing ./control.h"
  528. cat > ./control.h << '\Rogue\Monster\'
  529. typedef enum { FITBEZIER, DRAWPOLY, NOTACTIVE } CURMODE;
  530.  
  531. void SetFitBez();
  532. void SetPolyDraw();
  533.  
  534. extern CURMODE CurMode;
  535. extern void EditControl0();
  536. extern void EditControl1();
  537. \Rogue\Monster\
  538. else
  539.   echo "will not over write ./control.h"
  540. fi
  541. if `test ! -s ./fasttrig.c`
  542. then
  543. echo "writing ./fasttrig.c"
  544. cat > ./fasttrig.c << '\Rogue\Monster\'
  545. #include <math.h>
  546. #include "fasttrig.h"
  547.  
  548. extern char *malloc();
  549.  
  550. float *sintab;
  551. float *costab;
  552.  
  553. static int oldn = -1,
  554.        oldrange = -1,
  555.        oldstart = -1;
  556.  
  557.  
  558. /*
  559.  * return true if could not get memory for trig lookup tables
  560.  */
  561. bool InitFastTrig(angstart, angrange, n)
  562.     int angstart;
  563.     int angrange;
  564.     int n;
  565. {
  566.  
  567.  
  568.     int i;
  569.     float value;
  570.     float AngleInc;
  571.     float curangle;
  572.  
  573.     if( n == oldn && oldrange == angrange && oldstart == angstart ) {
  574.         return(false);
  575.     }
  576.  
  577.     if( n != oldn ) {
  578.         if( sintab ) free(sintab);
  579.         if( costab ) free(costab);
  580.         sintab = (float *)malloc( n * sizeof( float ));
  581.         costab = (float *)malloc( n * sizeof( float ));
  582.         if( !sintab || !costab ) {
  583.            return(true);
  584.         }
  585.     }
  586.  
  587.     oldn = n;
  588.     oldrange = angrange;
  589.     oldstart = angstart;
  590.  
  591.     AngleInc = (PI*angrange)/(180 *(n-1));
  592.     for( curangle = angstart*PI/180.0, i = 0;
  593.          i< n; i++, curangle += AngleInc ) {
  594.  
  595.         sintab[i] = sin( curangle );
  596.         costab[i] = cos( curangle );
  597.     }
  598.     return(false);
  599. }
  600. \Rogue\Monster\
  601. else
  602.   echo "will not over write ./fasttrig.c"
  603. fi
  604. if `test ! -s ./fasttrig.h`
  605. then
  606. echo "writing ./fasttrig.h"
  607. cat > ./fasttrig.h << '\Rogue\Monster\'
  608. #ifndef FASTTRIG_H_FILE
  609. #define FASTTRIG_H_FILE
  610.  
  611. #ifndef MYTYPES_H_FILE
  612. #include "mytypes.h"
  613. #endif !MYTYPES_H_FILE
  614.  
  615. #define MaxTrigEntries 512
  616. #define PI 3.1415927
  617.  
  618. extern float *sintab;
  619. extern float *costab;
  620.  
  621. #define fsin(sdeg) sintab[sdeg]
  622. #define fcos(sdeg) costab[sdeg]
  623.  
  624. bool InitFastTrig(/* float, int */);
  625.  
  626. #endif !FASTTRIG_H_FILE
  627. \Rogue\Monster\
  628. else
  629.   echo "will not over write ./fasttrig.h"
  630. fi
  631. if `test ! -s ./functions.h`
  632. then
  633. echo "writing ./functions.h"
  634. cat > ./functions.h << '\Rogue\Monster\'
  635. typedef    long    cList;
  636.  
  637. long                    AbleICR();
  638. void                    AbortIO();
  639. long                    ActivateGadget();
  640. void                    ActivateWindow();
  641. void                    AddAnimOb();
  642. void                    AddBob();
  643. void                    AddConfigDev();
  644. void                    AddDevice();
  645. long                    AddDosNode();
  646. void                    AddFont();
  647. long                    AddFreeList();
  648. short                    AddGadget();
  649. unsigned short            AddGList();
  650. void                    AddHead();
  651. struct Interrupt *        AddICRVector();
  652. void                    AddIntServer();
  653. void                    AddLibrary();
  654. long                    AddMemList();
  655. void                    AddPort();
  656. void                    AddResource();
  657. void                    AddSemaphore();
  658. void                    AddTail();
  659. void                    AddTask();
  660. void                    AddTime();
  661. void                    AddVSprite();
  662. long                    Alert();
  663. void *                    AllocAbs();
  664. long                    AllocBoardMem();
  665. cList                    AllocCList();
  666. struct ConfigDev *        AllocConfigDev();
  667. struct MemList *        AllocEntry();
  668. long                    AllocExpansionMem();
  669. void *                    AllocMem();
  670. long                    AllocPotBits();
  671. void *                    AllocRaster();
  672. char *                    AllocRemember();
  673. long                    AllocSignal();
  674. long                    AllocTrap();
  675. struct WBObject *        AllocWBObject();
  676. void *                    Allocate();
  677. void                    AlohaWorkbench();
  678. void                    AndRectRegion();
  679. long                    AndRegionRegion();
  680. void                    Animate();
  681. short                    AreaDraw();
  682. long                    AreaEllipse();
  683. void                    AreaEnd();
  684. short                    AreaMove();
  685. void                    AskFont();
  686. long                    AskSoftStyle();
  687. long                    AttemptLockLayerRom();
  688. long                    AttemptSemaphore();
  689. short                    AutoRequest();
  690. long                    AvailFonts();
  691. long                    AvailMem();
  692. void                    BeginIO();
  693. void                    BeginRefresh();
  694. void                    BeginUpdate();
  695. void                    BeginLayer();
  696. long                    BltBitMap();
  697. long                    BltBitMapRastPort();
  698. void                    BltClear();
  699. void                    BltMaskBitMapRastPort();
  700. void                    BltPattern();
  701. void                    BltTemplate();
  702. struct Window *            BuildSysRequest();
  703. char *                    BumpRevision();
  704. void                    Cause();
  705. void                    CBump();
  706. void                    CDInputHandler();
  707. void                    ChangeSprite();
  708. struct IORequest *        CheckIO();
  709. short                    ClearDMRequest();
  710. void                    ClearEOL();
  711. void                    ClearMenuStrip();
  712. void                    ClearPointer();
  713. void                    ClearRegion();
  714. long                    ClearRectRegion();
  715. void                    ClearScreen();
  716. void                    ClipBit();
  717. void                    Close();
  718. void                    CloseDevice();
  719. void                    CloseFont();
  720. void                    CloseLibrary();
  721. void                    CloseScreen();
  722. void                    CloseWindow();
  723. short                    CloseWorkBench();
  724. void                    CMove();
  725. short                    CmpTime();
  726. long                    ConcatCList();
  727. long                    ConfigBoard();
  728. long                    ConfigChain();
  729. long                    ConsoleDevice();
  730. long                    CopperListInit();
  731. cList                    CopyCList();
  732. void                    CopyMem();
  733. void                    CopyMemQuick();
  734. void                    CopySBitMap();
  735. void                    CreateBehindLayer();
  736. struct Lock *            CreateDir();
  737. struct MsgPort *        CreatePort();
  738. struct Process *        CreateProc();
  739. struct IOStdReq *        CreateStdIO();
  740. struct Task *            CreateTask();
  741. void                    CreateUpfrontLayer();
  742. struct Lock *            CurrentDir();
  743. void                    CurrentTime();
  744. void                    CWait();
  745. long *                    DateStamp();
  746. void                    Deallocate();
  747. void                    Debug();
  748. void                    Delay();
  749. short                    DeleteFile();
  750. void                    DeleteLayer();
  751. void                    DeletePort();
  752. void                    DeleteStdIO();
  753. void                    DeleteTask();
  754. struct Process *        DeviceProc();
  755. void                    Disable();
  756. void                    DisownBlitter();
  757. short                    DisplayAlert();
  758. void                    DisplayBeep();
  759. void                    DisposeRegion();
  760. void                    DoCollision();
  761. long                    DoIO();
  762. short                    DoubleClick();
  763. void                    Draw();
  764. void                    DrawBorder();
  765. void                    DrawEllipse();
  766. void                    DrawGList();
  767. void                    DrawImage();
  768. struct Lock *            DupLock();
  769. void                    Enable();
  770. void                    EndRefresh();
  771. void                    EndRequest();
  772. void                    EndUpdate();
  773. void                    Enqueue();
  774. short                    ExNext();
  775. short                    Examine();
  776. short                    Execute();
  777. void                    Exit();
  778. struct ConfigDev *        FindConfigDev();
  779. struct Node *            FindName();
  780. struct MsgPort *        FindPort();
  781. long                    FindResident();
  782. struct SignalSemaphore *FindSemaphore();
  783. struct Task *            FindTask();
  784. char *                    FindToolType();
  785. void                    Flood();
  786. void                    FlushCList();
  787. void                    Forbid();
  788. void                    FreeBoardMem();
  789. void                    FreeCList();
  790. void                    FreeColorMap();
  791. void                    FreeConfigDev();
  792. void                    FreeCopList();
  793. void                    FreeCprList();
  794. void                    FreeDiskObject();
  795. void                    FreeEntry();
  796. void                    FreeExpansionMem();
  797. void                    FreeFreeList();
  798. void                    FreeGBuffers();
  799. void                    FreeMem();
  800. void                    FreePotBits();
  801. void                    FreeRaster();
  802. void                    FreeRemember();
  803. void                    FreeSignal();
  804. void                    FreeSprite();
  805. void                    FreeSysRequest();
  806. void                    FreeTrap();
  807. void                    FreeVPortCopLists();
  808. void                    FreeWBObject();
  809. long                    GetCC();
  810. long                    GetCLBuf();
  811. short                    GetCLChar();
  812. short                    GetCLWord();
  813. struct ColorMap *        GetColorMap();
  814. long                    GetCurrentBinding();
  815. struct Preferences *    GetDefPrefs();
  816. struct DiskObject *        GetDiskObject();
  817. void                    GetGBuffers();
  818. long                    GetIcon();
  819. struct Message *        GetMsg();
  820. struct Preferences *    GetPrefs();
  821. short                    GetRGB4();
  822. long                    GetScreenData();
  823. short                    GetSprite();
  824. struct WBObject *        GetWBObject();
  825. long                    IncrCLMark();
  826. short                    Info();
  827. void                    InitArea();
  828. void                    InitBitMap();
  829. long                    InitCLPool();
  830. void                    InitCode();
  831. void                    InitGMasks();
  832. void                    InitGels();
  833. void                    InitMasks();
  834. void                    InitRastPort();
  835. void                    InitRequester();
  836. void                    InitResident();
  837. void                    InitSemaphore();
  838. void                    InitStruct();
  839. void                    InitTmpRas();
  840. void                    InitVPort();
  841. void                    InitView();
  842. struct FileHandle *        Input();
  843. void                    Insert();
  844. struct Region *            InstallClipRegion();
  845. long                    IntuiTextLength();
  846. struct InputEvent *        Intuition();
  847. long                    IoErr();
  848. short                    IsInteractive();
  849. struct MenuItem *        ItemAddress();
  850. void                    LoadRGB4();
  851. struct Segment *        LoadSeg();
  852. void                    LoadView();
  853. struct Lock *            Lock();
  854. void                    LockLayer();
  855. void                    LockLayerInfo();
  856. void                    LockLayerRom();
  857. void                    LockLayers();
  858. struct DeviceNode *        MakeDosNode();
  859. long                    MakeFunctions();
  860. struct Library *        MakeLibrary();
  861. void                    MakeScreen();
  862. void                    MakeVPort();
  863. long                    MarkCList();
  864. long                    MatchToolValue();
  865. void                    ModifyIDCMP();
  866. void                    ModifyProp();
  867. void                    Move();
  868. void                    MoveLayer();
  869. void                    MoveScreen();
  870. void                    MoveSprite();
  871. void                    MoveWindow();
  872. void                    MrgCop();
  873. void                    NewList();
  874. void                    NewModifyProp();
  875. struct Region *            NewRegion();
  876. void                    ObtainConfigBinding();
  877. void                    ObtainSemaphore();
  878. void                    ObtainSemaphoreList();
  879. void                    OffGadget();
  880. void                    OffMenu();
  881. void                    OnGadget();
  882. void                    OnMenu();
  883. struct FileHandle *        Open();
  884. long                    OpenDevice();
  885. struct Font *            OpenDiskFont();
  886. struct Font *            OpenFont();
  887. void                    OpenIntuition();
  888. struct Library *        OpenLibrary();
  889. struct MiscResource *    OpenResource();
  890. struct Screen *            OpenScreen();
  891. struct Window *            OpenWindow();
  892. short                    OpenWorkBench();
  893. void                    OrRectRegion();
  894. long                    OrRegionRegion();
  895. struct FileHandle *        Output();
  896. void                    OwnBlitter();
  897. struct Lock *            ParentDir();
  898. short                    PeekCLMark();
  899. void                    Permit();
  900. void                    PolyDraw();
  901. void                    PrintIText();
  902. long                    PutCLBuf();
  903. long                    PutCLChar();
  904. long                    PutCLWord();
  905. short                    PutDiskObject();
  906. long                    PutIcon();
  907. void                    PutMsg();
  908. long                    PutWBObject();
  909. void                    QBSBlit();
  910. void                    QBlit();
  911. short                    RawKeyConvert();
  912. long                    Read();
  913. char                    ReadExpansionByte();
  914. long                    ReadExpansionRom();
  915. short                    ReadPixel();
  916. void                    RectFill();
  917. void                    RefreshGadgets();
  918. void                    RefreshGList();
  919. void                    RefreshWindowFrame();
  920. void                    ReleaseConfigBinding();
  921. void                    ReleaseSemaphore();
  922. void                    ReleaseSemaphoreList();
  923. void                    RemConfigDev();
  924. void                    RemDevice();
  925. void                    RemFont();
  926. struct Node *            RemHead();
  927. void                    RemIBob();
  928. void                    RemICRVector();
  929. void                    RemIntServer();
  930. long                    RemLibrary();
  931. unsigned short            RemoveGList();
  932. void                    RemPort();
  933. void                    RemResource();
  934. void                    RemSemaphore();
  935. struct Node *            RemTail();
  936. void                    RemTask();
  937. void                    RemVSprite();
  938. void                    RemakeDisplay();
  939. void                    Remove();
  940. unsigned short            RemoveGadget();
  941. short                    Rename();
  942. void                    ReplyMsg();
  943. void                    ReportMouse();
  944. short                    Request();
  945. void                    RethinkDisplay();
  946. void                    ScreenToBack();
  947. void                    ScreenToFront();
  948. void                    ScrollLayer();
  949. void                    ScrollRaster();
  950. void                    ScrollVPort();
  951. long                    Seek();
  952. void                    SendIO();
  953. void                    SetAPen();
  954. void                    SetBPen();
  955. void                    SetCollision();
  956. short                    SetComment();
  957. void                    SetCurrentBinding();
  958. short                    SetDMRequest();
  959. void                    SetDRMd();
  960. long                    SetExcept();
  961. long                    SetFont();
  962. long                    SetFunction();
  963. long                    SetICR();
  964. struct Interrupt *        SetIntVector();
  965. void                    SetMenuStrip();
  966. void                    SetPointer();
  967. void                    SetPrefs();
  968. short                    SetProtection();
  969. void                    SetRast();
  970. void                    SetRGB4();
  971. void                    SetRGB4CM();
  972. long                    SetSR();
  973. long                    SetSignal();
  974. long                    SetSoftStyle();
  975. short                    SetTaskPri();
  976. void                    SetWindowTitles();
  977. void                    ShowTitle();
  978. void                    Signal();
  979. long                    SizeCList();
  980. void                    SizeLayer();
  981. void                    SizeWindow();
  982. void                    SortGList();
  983. cList                    SplitCList();
  984. cList                    SubCList();
  985. void                    SubTime();
  986. void                    SubLibrary();
  987. void                    SumKickData();
  988. long                    SuperState();
  989. void                    SwapBitsRastPortClipRect();
  990. void                    SyncSBitMap();
  991. long                    Text();
  992. long                    TextLength();
  993. long                    Translate();
  994. long                    UnGetCLChar();
  995. long                    UnGetCLWord();
  996. void                    UnLoadSeg();
  997. void                    UnLock();
  998. short                    UnPutCLChar();
  999. short                    UnPutCLWord();
  1000. void                    UnlockLayer();
  1001. void                    UnlockLayerInfo();
  1002. void                    UnlockLayerRom();
  1003. void                    UnlockLayers();
  1004. void                    UpfrontLayer();
  1005. void                    UserState();
  1006. short                    VBeamPos();
  1007. struct View *            ViewAddress();
  1008. struct ViewPort *        ViewPortAddress();
  1009. short                    WBenchToBack();
  1010. short                    WBenchToFront();
  1011. long                    Wait();
  1012. void                    WaitBOVP();
  1013. void                    WaitBlit();
  1014. short                    WaitForChar();
  1015. long                    WaitIO();
  1016. struct Message *        WaitPort();
  1017. void                    WaitTOF();
  1018. struct Layer *            WhichLayer();
  1019. short                    WindowLimits();
  1020. void                    WindowToBack();
  1021. void                    WindowToFront();
  1022. long                    Write();
  1023. long                    WriteExpansionByte();
  1024. void                    WritePixel();
  1025. void                    WritePotgo();
  1026. void                    XorRectRegion();
  1027. long                    XorRegionRegion();
  1028.  
  1029. \Rogue\Monster\
  1030. else
  1031.   echo "will not over write ./functions.h"
  1032. fi
  1033. if `test ! -s ./gadgetdef.c`
  1034. then
  1035. echo "writing ./gadgetdef.c"
  1036. cat > ./gadgetdef.c << '\Rogue\Monster\'
  1037. /* this file contains definition for the screen */
  1038.  
  1039. #include "scrnio.ih"
  1040. #include <exec/memory.h>
  1041. #ifdef MANX
  1042. #include <functions.h>
  1043. #endif
  1044.  
  1045. #include "scrndef.h"
  1046. #include "gadgetdef.h"
  1047. #include "mytypes.h"
  1048. #include "bezpt.h"
  1049. #include "poly.h"
  1050. #include "revolve.h"
  1051. #include "readilbm.h"
  1052.  
  1053. /*
  1054.  * definition for image of hourglass
  1055.  */
  1056. static UWORD HourGlassDat[] = {
  1057.  0x0, 0x0, 0x0, 0xffff,
  1058.  0x7ffe, 0x8001, 0x6006, 0x9ff9,
  1059.  0x2004, 0x5ffa, 0x1c38, 0x2ff4,
  1060.  0xf70, 0x17e8, 0x7e0, 0xbd0,
  1061.  0x2c0, 0x5a0, 0x240, 0x5a0,
  1062.  0x420, 0xbd0, 0x910, 0x17e8,
  1063.  0x1788, 0x2ff4, 0x2fe4, 0x5ffa,
  1064.  0x7ff6, 0x9ff9, 0x7ffe, 0x8001,
  1065.  0x0, 0xffff, 0x0, 0x0
  1066.  };
  1067.  
  1068. UWORD *HourGlass = NULL;
  1069.  
  1070.  
  1071.  
  1072.  
  1073. /*
  1074.  * actual gadget definitions
  1075.  */
  1076. #define TOP 13
  1077. #define ROW 9
  1078. #define COL 8
  1079. #define TxOff 1
  1080.        /*
  1081.         * start of boolean gadgets
  1082.         */
  1083. #define BOOLGADFLAGS (RELVERIFY|TOPBORDER)
  1084. #define BOOLTOP 0
  1085. #define BOOLLEFT 0
  1086.  
  1087. static struct IntuiText TextDefLines = {
  1088.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Lines", NULL };
  1089.  
  1090. static struct Gadget G_DefLines = {
  1091.     NULL,
  1092.     BOOLLEFT , BOOLTOP , 5*COL, ROW, /* loc and size of hit box */
  1093.     GADGHBOX,    /* complemented when pressed */
  1094.     BOOLGADFLAGS,    /* just get gadget up messages */
  1095.     BOOLGADGET,
  1096.     NULL, NULL,
  1097.     &TextDefLines,
  1098.     0, NULL,
  1099.     (int)N_DefLines,
  1100.     NULL
  1101.  };
  1102.  
  1103.  
  1104. static struct IntuiText TextEditBez = {
  1105.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Curves", NULL };
  1106.  
  1107. static struct Gadget G_EditBez = {
  1108.     &G_DefLines,
  1109.     BOOLLEFT+COL*6, BOOLTOP, 6*COL, ROW, /* loc and size of hit box */
  1110.     GADGHBOX,    /* complemented when pressed */
  1111.     RELVERIFY,    /* just get gadget up messages */
  1112.     BOOLGADGET,
  1113.     NULL, NULL,
  1114.     &TextEditBez,
  1115.     0, NULL,
  1116.     (int)N_EditBez,
  1117.     NULL
  1118.  };
  1119.  
  1120.  
  1121. static struct IntuiText TextMap = {
  1122.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Map", NULL };
  1123.  
  1124. static struct Gadget G_Map = {
  1125.     &G_EditBez,
  1126.     BOOLLEFT +24*COL, BOOLTOP, 3*COL, ROW, /* loc and size of hit box */
  1127.     GADGHBOX,    /* complemented when pressed */
  1128.     RELVERIFY,    /* just get gadget up messages */
  1129.     BOOLGADGET,
  1130.     NULL, NULL,
  1131.     &TextMap,
  1132.     0, NULL,
  1133.     (int)N_Map,
  1134.     NULL
  1135.  };
  1136.  
  1137.  
  1138. static struct IntuiText TextWire = {
  1139.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Wire", NULL };
  1140.  
  1141. static struct Gadget G_Wire = {
  1142.     &G_Map,
  1143.     BOOLLEFT +13*COL, BOOLTOP, 4*COL, ROW, /* loc and size of hit box */
  1144.     GADGHBOX,    /* complemented when pressed */
  1145.     RELVERIFY,    /* just get gadget up messages */
  1146.     BOOLGADGET,
  1147.     NULL, NULL,
  1148.     &TextWire,
  1149.     0, NULL,
  1150.     (int)N_Wire,
  1151.     NULL
  1152.  };
  1153.  
  1154. static struct IntuiText TextShaded = {
  1155.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Shade", NULL };
  1156.  
  1157. static struct Gadget G_Shaded = {
  1158.     &G_Wire,
  1159.     BOOLLEFT +18*COL, BOOLTOP, 5*COL, ROW, /* loc and size of hit box */
  1160.     GADGHBOX,    /* complemented when pressed */
  1161.     RELVERIFY,    /* just get gadget up messages */
  1162.     BOOLGADGET,
  1163.     NULL, NULL,
  1164.     &TextShaded,
  1165.     0, NULL,
  1166.     (int)N_Shaded,
  1167.     NULL
  1168.  };
  1169.  
  1170. static struct IntuiText TextGoPanel = {
  1171.     -1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Panel", NULL };
  1172.  
  1173. static struct Gadget G_GoPanel = {
  1174.     &G_Shaded,
  1175.     BOOLLEFT +28*COL, BOOLTOP, 5*COL, ROW, /* loc and size of hit box */
  1176.     GADGHBOX,    /* complemented when pressed */
  1177.     RELVERIFY,    /* just get gadget up messages */
  1178.     BOOLGADGET,
  1179.     NULL, NULL,
  1180.     &TextGoPanel,
  1181.     0, NULL,
  1182.     (int)N_GoPanel,
  1183.     NULL
  1184.  };
  1185.  
  1186. static struct IntuiText TextGoSurf = {
  1187.     1,-1,JAM1, 0, TxOff, NULL,(UBYTE *) "Display", NULL };
  1188.  
  1189. static short S_GoSurf[] = {
  1190.     -2,-1,  -2,ROW+1,  7*COL+2,ROW+1,  7*COL+2,-1, -2,-1
  1191.  };
  1192.  
  1193. static struct Border B_GoSurf = { 0, 0, 1, 0, JAM1, 5, S_GoSurf, NULL };
  1194.  
  1195. static struct Gadget G_GoSurf = {
  1196.     NULL,
  1197.     2*COL, TOP, 7*COL, ROW, /* loc and size of hit box */
  1198.     GADGHBOX,    /* complemented when pressed */
  1199.     RELVERIFY,    /* just get gadget up messages */
  1200.     BOOLGADGET,
  1201.     (APTR)&B_GoSurf, NULL,
  1202.     &TextGoSurf,
  1203.     0, NULL,
  1204.     (int)N_GoSurf,
  1205.     NULL
  1206.  };
  1207.  
  1208.         /*
  1209.          * beginning of slider gadgets
  1210.          */
  1211. #define GadFlags    (GADGIMAGE | GADGHNONE)  /* my gadget flags */
  1212. #define MyPropType (PROPGADGET)
  1213.  
  1214. /*
  1215.  *  definitions for the number of Revolution Slices
  1216.  */
  1217.  
  1218. static char DispRevSlices[] = { "Rev Slices=[   ]" };
  1219.  
  1220. static struct IntuiText TextRevSlices = {
  1221.     1,1,JAM1, -sizeof(DispRevSlices)*COL, TxOff, NULL,
  1222.     (UBYTE *)DispRevSlices, NULL
  1223.  };
  1224.  
  1225. struct GadExtens VRevSlices = {0.0, 0.0, 0.0, 1, 360, DefRevMeshVal, false };
  1226.  
  1227. static struct Gadget G_RevSlices = {
  1228.     &G_GoSurf,
  1229.     COL*57 , TOP+ROW*2, COL*15, ROW, /* loc and size */
  1230.     GadFlags,
  1231.     RELVERIFY,
  1232.     MyPropType,
  1233.     NULL,
  1234.     NULL , /* high lighted */
  1235.     &TextRevSlices,
  1236.     0x0,
  1237.     NULL,
  1238.     (int)N_RevSlices,
  1239.     (APTR) &VRevSlices
  1240.  };
  1241.  
  1242. /*
  1243.  * definition for the background shade
  1244.  */
  1245. static char DispBackPlane[] = { "Background = [  ]" };
  1246.  
  1247. static struct IntuiText TextBackPlane = {
  1248.     1,1,JAM1, -sizeof(DispBackPlane)*COL, TxOff, NULL,
  1249.     (UBYTE *)DispBackPlane, NULL
  1250.  };
  1251.  
  1252. struct GadExtens VBackPlane = {0.0, 0.0, 0.0, 0, 31, DefBkPlane, false};
  1253.  
  1254.  
  1255. static struct Gadget G_BackPlane = {
  1256.     &G_RevSlices,
  1257.     COL*57 , TOP+ROW*13, COL*15, ROW, /* loc and size */
  1258.     GadFlags,
  1259.     RELVERIFY,
  1260.     MyPropType,
  1261.     NULL,
  1262.     NULL , /* high lighted */
  1263.     &TextBackPlane,
  1264.     0x0,
  1265.     NULL,
  1266.     (int)N_BackPlane,
  1267.     (APTR) &VBackPlane
  1268.  };
  1269.  
  1270.  
  1271. /*
  1272.  *  definitions for the number of Revolution Angles
  1273.  */
  1274.  
  1275. static char DispRevAngle[] = { "Rev Angle=[   ]" };
  1276.  
  1277. static struct IntuiText TextRevAngle = {
  1278.     1,1,JAM1, -sizeof(DispRevAngle)*COL, TxOff, NULL,
  1279.     (UBYTE *)DispRevAngle, NULL
  1280.  };
  1281.  
  1282. struct GadExtens VRevAngle = { 0.0, 0.0, 0.0, 0, 360, DefRotRange, false };
  1283.  
  1284.  
  1285. static struct Gadget G_RevAngle = {
  1286.     &G_BackPlane,
  1287.     COL*57 , TOP+ROW*3, COL*15, ROW, /* loc and size */
  1288.     GadFlags,
  1289.     RELVERIFY,
  1290.     MyPropType ,
  1291.     NULL,
  1292.     NULL, /* high lighted */
  1293.     &TextRevAngle,
  1294.     0x0,
  1295.     NULL,
  1296.     (int)N_RevAngle,
  1297.     (APTR) &VRevAngle
  1298.  };
  1299. /*
  1300.  *  definitions for start rotation angle
  1301.  */
  1302.  
  1303. static char DispRevStart[] = { "Start Angle=[   ]" };
  1304.  
  1305. static struct IntuiText TextRevStart = {
  1306.     1,1,JAM1, -sizeof(DispRevStart)*COL, TxOff, NULL,
  1307.     (UBYTE *)DispRevStart, NULL
  1308.  };
  1309.  
  1310. struct GadExtens VRevStart = { 0.0, 0.0, 0.0, 0, 360, DefRotStart, false };
  1311.  
  1312.  
  1313. static struct Gadget G_RevStart = {
  1314.     &G_RevAngle,
  1315.     COL*57 , TOP+ROW*4, COL*15, ROW, /* loc and size */
  1316.     GadFlags,
  1317.     RELVERIFY,
  1318.     MyPropType ,
  1319.     NULL,
  1320.     NULL, /* high lighted */
  1321.     &TextRevStart,
  1322.     0x0,
  1323.     NULL,
  1324.     (int)N_RevStart,
  1325.     (APTR) &VRevStart
  1326.  };
  1327.  
  1328. /*
  1329.  *  definitions for the number of Bezier Slices
  1330.  */
  1331.  
  1332. static char DispBezSlices[] = { "Bez Slices=[   ]" };
  1333.  
  1334. static struct IntuiText TextBezSlices = {
  1335.     1,1,JAM1, -sizeof(DispBezSlices)*COL, TxOff, NULL,
  1336.     (UBYTE *)DispBezSlices, NULL
  1337.  };
  1338.  
  1339.  
  1340. struct GadExtens VBezSlices = { 0.0, 0.0, 0.0, 1, 100, DefBezMeshVal, false };
  1341.  
  1342. static struct Gadget G_BezSlices = {
  1343.     &G_RevStart,
  1344.     COL*20 , TOP+ROW*2, COL*15, ROW, /* loc and size */
  1345.     GadFlags,
  1346.     RELVERIFY,
  1347.     MyPropType ,
  1348.     NULL,
  1349.     NULL, /* high lighted */
  1350.     &TextBezSlices,
  1351.     0x0,
  1352.     NULL,
  1353.     (int)N_BezSlices,
  1354.     (APTR)&VBezSlices
  1355.  };
  1356.  
  1357. /*
  1358.  *  definitions for tilt angle
  1359.  */
  1360.  
  1361. static char DispTiltAng[] = { "Tilt Angle=[   ]" };
  1362.  
  1363. static struct IntuiText TextTiltAng = {
  1364.     1,1,JAM1, -sizeof(DispTiltAng)*COL, TxOff, NULL,
  1365.     (UBYTE *)DispTiltAng, NULL
  1366.  };
  1367.  
  1368.  
  1369. struct GadExtens VTiltAng = { 0.0, 0.0, 0.0, 0, 360, DefTilt, false };
  1370.  
  1371. static struct Gadget G_TiltAng = {
  1372.     &G_BezSlices,
  1373.     COL*20 , TOP+ROW*3, COL*15, ROW, /* loc and size */
  1374.     GadFlags,
  1375.     RELVERIFY,
  1376.     MyPropType ,
  1377.     NULL,
  1378.     NULL, /* high lighted */
  1379.     &TextTiltAng,
  1380.     0x0,
  1381.     NULL,
  1382.     (int)N_TiltAng,
  1383.     (APTR) &VTiltAng
  1384.  };
  1385.  
  1386.  
  1387. /*
  1388.  * definitions for K Specular
  1389.  */
  1390.  
  1391. static char DispKspec[] = {"Kspecular=[     ] " };
  1392.  
  1393. static struct IntuiText TextKspec = {
  1394.     1,1,JAM1, -sizeof(DispKspec)*COL, TxOff, NULL,
  1395.     (UBYTE *)DispKspec, NULL
  1396.  };
  1397.  
  1398.  
  1399. struct GadExtens VKspec = { 0.0, 1.0, DefKs, 0, 0, 0, true };
  1400.  
  1401. static struct Gadget G_Kspec = {
  1402.     &G_TiltAng,
  1403.     49*COL , TOP+ROW*9, COL*15, ROW, /* loc and size */
  1404.     GadFlags,
  1405.     RELVERIFY,
  1406.     MyPropType ,
  1407.     NULL,
  1408.     NULL, /* high lighted */
  1409.     &TextKspec,
  1410.     0x0,
  1411.     NULL,
  1412.     (int)N_Kspec,
  1413.     (APTR) &VKspec
  1414.  };
  1415.  
  1416. /*
  1417.  * definitions for K diffuse
  1418.  */
  1419.  
  1420. static char DispKdiffuse[] = {"Kdiffuse=[     ] " };
  1421.  
  1422. static struct IntuiText TextKdiffuse = {
  1423.     1,1,JAM1, -sizeof(DispKdiffuse)*COL, TxOff, NULL,
  1424.     (UBYTE *)DispKdiffuse, NULL
  1425.  };
  1426.  
  1427.  
  1428. struct GadExtens VKdiffuse = { 0.0, 1.0, DefKd, 0, 0, 0, true };
  1429.  
  1430. static struct Gadget G_Kdiffuse = {
  1431.     &G_Kspec,
  1432.     49*COL , TOP+ROW*10, COL*15, ROW, /* loc and size */
  1433.     GadFlags,
  1434.     RELVERIFY,
  1435.     MyPropType ,
  1436.     NULL,
  1437.     NULL, /* high lighted */
  1438.     &TextKdiffuse,
  1439.     0x0,
  1440.     NULL,
  1441.     (int)N_Kdiffuse,
  1442.     (APTR) &VKdiffuse
  1443.  };
  1444.  
  1445.  
  1446.  
  1447. /*
  1448.  * definitions for DispPtIntens
  1449.  */
  1450.  
  1451.  
  1452. static struct IntuiText PtProperties = {
  1453.     1,1,JAM1, -10*COL, -ROW, NULL,
  1454.     (UBYTE *)"Properties", NULL
  1455.  };
  1456.  
  1457. static char DispPtIntens[] = {"Intensity=[     ] " };
  1458.  
  1459. static struct IntuiText TextPtIntens = {
  1460.     1,1,JAM1, -sizeof(DispPtIntens)*COL, TxOff, NULL,
  1461.     (UBYTE *)DispPtIntens, &PtProperties
  1462.  };
  1463.  
  1464.  
  1465. struct GadExtens VPtIntens = { 0.0, 2.5, DefIntensity , 0, 0, 0, true };
  1466.  
  1467. static struct Gadget G_PtIntens = {
  1468.     &G_Kdiffuse,
  1469.     49*COL , TOP+ROW*8, COL*15, ROW, /* loc and size */
  1470.     GadFlags,
  1471.     RELVERIFY,
  1472.     MyPropType ,
  1473.     NULL,
  1474.     NULL, /* high lighted */
  1475.     &TextPtIntens,
  1476.     0x0,
  1477.     NULL,
  1478.     (int)N_PtIntens,
  1479.     (APTR) &VPtIntens
  1480.  };
  1481.  
  1482.  
  1483.  
  1484.  
  1485. /*
  1486.  * definitions for background intensity
  1487.  */
  1488. static struct IntuiText DispAmbient= {
  1489.     1,1,JAM1,- COL*3, -ROW, NULL,
  1490.     (UBYTE *) "Other", NULL
  1491.  };
  1492.  
  1493. static char DispBkIntens[] = { "Ambience=[     ] " };
  1494.  
  1495. static struct IntuiText TextBkIntens = {
  1496.     1,1,JAM1, -sizeof(DispBkIntens)*COL, TxOff, NULL,
  1497.     (UBYTE *) DispBkIntens, &DispAmbient
  1498.  };
  1499.  
  1500. struct GadExtens VBkIntens = { 0.0, 1.0, DefAmbience, 0, 0, 0, true };
  1501.  
  1502.  
  1503. static struct Gadget G_BkIntens = {
  1504.     &G_PtIntens,
  1505.     20*COL , TOP+ROW*13, COL*15, ROW, /* loc and size */
  1506.     GadFlags,
  1507.     RELVERIFY,
  1508.     MyPropType,
  1509.     NULL,
  1510.     NULL, /* high lighted */
  1511.     &TextBkIntens,
  1512.     0x0,
  1513.     NULL,
  1514.     (int)N_BkIntens,
  1515.     (APTR)&VBkIntens
  1516.  };
  1517.  
  1518.  
  1519.  
  1520.  
  1521. /*
  1522.  * Definitions for Surface distance
  1523.  */
  1524.  
  1525. static char DispSurfDist[] = {"Surf Dist=[     ] " };
  1526.  
  1527. static struct IntuiText TextSurfDist = {
  1528.     1,1,JAM1, -sizeof(DispSurfDist)*COL, TxOff, NULL,
  1529.     (UBYTE *) DispSurfDist, NULL
  1530.  };
  1531.  
  1532.  
  1533. struct GadExtens VSurfDist = {0.0, 0.0, 0.0, -500, 3000, DefSurfDist, false};
  1534.  
  1535. static struct Gadget G_SurfDist = {
  1536.     &G_BkIntens,
  1537.     20*COL , TOP+ROW*4, COL*15, ROW, /* loc and size */
  1538.     GadFlags,
  1539.     RELVERIFY,
  1540.     MyPropType,
  1541.     NULL,
  1542.     NULL, /* high lighted */
  1543.     &TextSurfDist,
  1544.     0x0,
  1545.     NULL,
  1546.     (int)N_SurfDist,
  1547.     (APTR)&VSurfDist
  1548.  };
  1549.  
  1550.  
  1551.  
  1552.  
  1553. /*
  1554.  * definitions for location.x
  1555.  */
  1556. static struct IntuiText PointLight = {
  1557.     1,1,JAM1, 9*COL, -ROW*2, NULL,
  1558.     (UBYTE *) "Point Light Source", NULL
  1559.  };
  1560.  
  1561. static struct IntuiText TextPtLocXYZ = {
  1562.     1,1,JAM1, -4, -ROW, NULL,
  1563.     (UBYTE *) "Location", &PointLight
  1564.  };
  1565.  
  1566. static char DispPtLocX[] = { "x=[     ] " };
  1567.  
  1568. static struct IntuiText TextPtLocX = {
  1569.     1,1,JAM1, -sizeof(DispPtLocX)*COL, TxOff, NULL,
  1570.     (UBYTE *) DispPtLocX, &TextPtLocXYZ
  1571.  };
  1572.  
  1573.  
  1574. struct GadExtens VPtLocX = {0.0, 0.0, 0.0, -6000, 6000, DefLightSrcX, false };
  1575.  
  1576. static struct Gadget G_PtLocX = {
  1577.     &G_SurfDist,
  1578.     12*COL , TOP+ROW*8, COL*15, ROW, /* loc and size */
  1579.     GadFlags,
  1580.     RELVERIFY,
  1581.     MyPropType,
  1582.     NULL,
  1583.     NULL, /* high lighted */
  1584.     &TextPtLocX,
  1585.     0x0,
  1586.     NULL,
  1587.     (int)N_PtLocX,
  1588.     (APTR) &VPtLocX
  1589.  };
  1590.  
  1591.  
  1592.  
  1593. /*
  1594.  * definitions for location.x
  1595.  */
  1596.  
  1597. static char DispPtLocY[] = "y=[     ] ";
  1598.  
  1599. static struct IntuiText TextPtLocY = {
  1600.     1,1,JAM1, -sizeof(DispPtLocY)*COL, TxOff, NULL,
  1601.     (UBYTE *) DispPtLocY, NULL
  1602.  };
  1603.  
  1604.  
  1605. struct GadExtens VPtLocY = { 0.0, 0.0, 0.0, -6000, 6000, DefLightSrcY, false };
  1606.  
  1607. static struct Gadget G_PtLocY = {
  1608.     &G_PtLocX,
  1609.     12*COL , TOP+ROW*9, COL*15, ROW, /* loc and size */
  1610.     GadFlags,
  1611.     RELVERIFY,
  1612.     MyPropType,
  1613.     NULL,
  1614.     NULL, /* high lighted */
  1615.     &TextPtLocY,
  1616.     0x0,
  1617.     NULL,
  1618.     (int)N_PtLocY,
  1619.     (APTR) &VPtLocY
  1620.  };
  1621.  
  1622.  
  1623.  
  1624.  /*
  1625.   * definitions for location.z
  1626.   */
  1627.  
  1628. static char DispPtLocZ[] = { "z=[     ] " };
  1629.  
  1630. static struct IntuiText TextPtLocZ = {
  1631.     1,1,JAM1, -sizeof(DispPtLocZ)*COL, TxOff, NULL,
  1632.     (UBYTE *)DispPtLocZ, NULL
  1633.  };
  1634.  
  1635.  
  1636. struct GadExtens VPtLocZ ={ 0.0, 0.0, 0.0, -1000, 3000, DefLightSrcZ, false };
  1637.  
  1638. static struct Gadget G_PtLocZ = {
  1639.     &G_PtLocY,
  1640.     12*COL , TOP+ROW*10, COL*15, ROW, /* loc and size */
  1641.     GadFlags,
  1642.     RELVERIFY,
  1643.     MyPropType,
  1644.     NULL,
  1645.     NULL, /* high lighted */
  1646.     &TextPtLocZ,
  1647.     0x0,
  1648.     NULL,
  1649.     (int)N_PtLocZ,
  1650.     (APTR) &VPtLocZ
  1651.  };
  1652.  
  1653.  /*
  1654.   * definitions for Map replication in horizontal axis
  1655.   */
  1656.  
  1657. static char DispRepH[] = { "Map RepH=[     ] " };
  1658.  
  1659. static struct IntuiText TextRepH = {
  1660.     1,1,JAM1, -sizeof(DispRepH)*COL, TxOff, NULL,
  1661.     (UBYTE *)DispRepH, NULL
  1662.  };
  1663.  
  1664.  
  1665. struct GadExtens VRepH ={ 0.0, 0.0, 0.0, 1, 300, DefRepH, false };
  1666.  
  1667. static struct Gadget G_RepH = {
  1668.     &G_PtLocZ,
  1669.     20*COL , TOP+ROW*15, COL*15, ROW, /* loc and size */
  1670.     GadFlags,
  1671.     RELVERIFY,
  1672.     MyPropType,
  1673.     NULL,
  1674.     NULL, /* high lighted */
  1675.     &TextRepH,
  1676.     0x0,
  1677.     NULL,
  1678.     (int)N_RepH,
  1679.     (APTR) &VRepH
  1680.  };
  1681.  
  1682.  
  1683.  /*
  1684.   * definitions for map replication in vertical axis
  1685.   */
  1686.  
  1687. static char DispRepV[] = { "Map RepV=[     ] " };
  1688.  
  1689. static struct IntuiText TextRepV = {
  1690.     1,1,JAM1, -sizeof(DispRepV)*COL, TxOff, NULL,
  1691.     (UBYTE *)DispRepV, NULL
  1692.  };
  1693.  
  1694.  
  1695. struct GadExtens VRepV ={ 0.0, 0.0, 0.0, 1, 300, DefRepV, false };
  1696.  
  1697. static struct Gadget G_RepV = {
  1698.     &G_RepH,
  1699.     57*COL , TOP+ROW*15, COL*15, ROW, /* loc and size */
  1700.     GadFlags,
  1701.     RELVERIFY,
  1702.     MyPropType,
  1703.     NULL,
  1704.     NULL, /* high lighted */
  1705.     &TextRepV,
  1706.     0x0,
  1707.     NULL,
  1708.     (int)N_RepV,
  1709.     (APTR) &VRepV
  1710.  };
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717. LoadChipMem( dest, src, srcsize)
  1718.     UWORD **dest;
  1719.     UWORD *src;
  1720.     int srcsize;
  1721. {
  1722.     UWORD *d;
  1723.  
  1724.     d = (UWORD *)AllocMem( srcsize, MEMF_CHIP );
  1725.     *dest = d;
  1726.     while( srcsize ) {
  1727.         *d++ = *src++;
  1728.         srcsize -= sizeof( UWORD );
  1729.     }
  1730. }
  1731.  
  1732.  
  1733. void InitGadgets()
  1734. {
  1735.     struct Gadget *vp;
  1736.     LoadChipMem( &HourGlass, HourGlassDat, sizeof(HourGlassDat));
  1737.  
  1738.  
  1739.     CntrlWinDef.FirstGadget = &G_RepV;
  1740.     GadWinDef.FirstGadget = &G_GoPanel;
  1741.     /*
  1742.      * fill in numeric fields
  1743.      */
  1744.     for( vp = CntrlWinDef.FirstGadget; vp; vp = vp->NextGadget ) {
  1745.         GadgetSetVal( vp );
  1746.         GadgetUpdate(vp, false );
  1747.     }
  1748. }
  1749.  
  1750.  
  1751. void EndGadgets()
  1752. {
  1753.     if( HourGlass ) {
  1754.         FreeMem(HourGlass, sizeof(HourGlassDat ));
  1755.     }
  1756. }
  1757. \Rogue\Monster\
  1758. else
  1759.   echo "will not over write ./gadgetdef.c"
  1760. fi
  1761. echo "Finished archive 3 of 3"
  1762. # if you want to concatenate archives, remove anything after this line
  1763. exit
  1764. -- 
  1765. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  1766. "I can't tell the difference between ABC News and Hill Street Blues" -Bono
  1767.